package edu.zut.bailan.cart.service.impl;


import edu.zut.bailan.base.service.impl.GenericManagerImpl;
import edu.zut.bailan.cart.dao.CartDao;
import edu.zut.bailan.cart.domain.Cart;
import edu.zut.bailan.cart.service.CartManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;


import java.util.ArrayList;
import java.util.List;

@Component
@Transactional
public class CartManagerImpl extends GenericManagerImpl<Cart,Long>
        implements CartManager {

    CartDao cartDao;

    @Autowired
    public void setCartDao(CartDao cartDao) {
        this.cartDao = cartDao;
        this.dao = this.cartDao;
    }

    @Override
    public List list() {
        List list = new ArrayList();
        for (int i = 0; i < 100; i++) {
            Cart cart = new Cart();
            cart.setCode("cart_"+i);
            cart.setPrice(i);
            cart.setEntityName("edu.zut.hb.fortune");
            list.add(cart);
        }
        return list;
    }

}
